library(progress)
suppressMessages(library(tidyverse)); suppressMessages(library(magrittr))
x <- 1:56
pb <- progress_bar$new(total = length(x),width = 52,clear = F,format = "[:bar] :percent :eta" )
purrr::walk(x, ~{pb$tick(); Sys.sleep(0.04)})
rm(pb)


pb <- progress_bar$new(total = length(x)*10 , width = 45, clear = F, format = "[:bar] :percent :eta")
purrr::walk(x, ~ {    
    walk(1:10, ~ {
        pb$tick()
        Sys.sleep(0.01)
    })
})


library(progress)
pb <- progress_bar$new(total = 8, width = 45, clear = F, format = "[:bar] :percent :eta",incomplete = ' ')
for(i in 1:8){
    pb$tick()
    Sys.sleep(.2)
}


i = 1
pb <- progress_bar$new(total = 10, width = 40, clear = F, format = "[:bar] :percent",incomplete = ' ',complete = "+")
while(i <= 10){
    Sys.sleep(.2)
    pb$tick()
    i = i+1
}



pb <- progress_bar$new(total = 5, width = 30, clear = F, format = "[:bar] :percent",incomplete = ' ',complete = "=",current = '_')
x <- 1
repeat {
    x <- x + 1
    pb$tick()
    Sys.sleep(.2)
    if (x == 6) {
        break
    }
}

x <- 1:2
pb <- progress_bar$new(total = length(x) * 10, width = 40, clear = F, format = "[:bar] :percent :eta :spin")
a = lapply(x, function(...) {
    lapply(1:10, function(...) {
        pb$tick()
        Sys.sleep(0.1)
        invisible()
    })
    invisible()
})



pb <- txtProgressBar(min = 0, max = 100, style = 3, width  = 40)
for(i in 1:100) {
  Sys.sleep(0.05) 
  setTxtProgressBar(pb, i)
}
close(pb)
